home *** CD-ROM | disk | FTP | other *** search
- <html>
-
- <head>
-
- <title>Dynamic Layer Content</title>
-
- </head>
-
- <body bgcolor="white">
-
- <script language="Javascript1.2">
-
- <!--//
-
-
-
- //The growPic and shrinkPic functions resize the layers and
-
- //use the document.write() method to replace the layer's content
-
- //with the same image, width larger or smaller height and width
-
- //values.
-
-
-
- function growPic(targetLayer, img, height, width) {
-
- if((targetLayer.clip.height <= height) || (targetLayer.clip.width <= width)) {
-
- if (targetLayer.clip.height <= height) targetLayer.clip.height = targetLayer.clip.height + 1;
-
- if (targetLayer.clip.width <= width) targetLayer.clip.width = targetLayer.clip.width + 1;
-
- targetLayer.document.write("<img src='" + img + "' width="+targetLayer.clip.width+"
- height="+targetLayer.clip.height+">");
-
- targetLayer.document.close();
-
- setTimeout('growPic(document.layers["'+targetLayer.name+'"],"'+img+'",'+height+','+width+')',1);
-
- }
-
- }
-
-
-
- function shrinkPic(targetLayer, img, height, width) {
-
- if((targetLayer.clip.height >= height) || (targetLayer.clip.width >= width)) {
-
- if (targetLayer.clip.height >= height) targetLayer.clip.height = targetLayer.clip.height - 1;
-
- if (targetLayer.clip.width >= width) targetLayer.clip.width = targetLayer.clip.width - 1;
-
- targetLayer.document.write("<img src='" + img + "' width="+targetLayer.clip.width+"
- height="+targetLayer.clip.height+">");
-
- targetLayer.document.close();
-
- setTimeout('shrinkPic(document.layers["'+targetLayer.name+'"],"'+img+'",'+height+','+width+')',1);
-
- }
-
-
-
- }
-
-
-
- //-->
-
- </script>
-
- <body bgcolor="white">
-
- <layer id="control" height=40 width=100 top=4 left=0>
-
- <!--- notice how the script is called 'parent.window.document' -->
-
- <!--- this is used to call scripts in other windows and other -->
-
- <!--- child layers within the document. A necessary evil sometimes.-->
-
- <form>
-
- <input type="button" value="Grow"
-
- onClick="growPic(parent.window.document.layers['puppy'], 'puppy.gif',100,100)"><input
-
- type="button" value="Shrink"
-
- onClick="shrinkPic(parent.window.document.layers['puppy'], 'puppy.gif',25,25)">
-
- </form>
-
- </layer>
-
- <layer id="puppy" height=50 width=50 top=44 left=0>
-
- <img src="puppy.gif" border=0 height=50 width=50>
-
- </layer>
-
- </body>
-
- </html>
-
-